[jquery] return the inserted element

Posted by Quamis on Stack Overflow See other posts from Stack Overflow or by Quamis
Published on 2010-04-23T23:07:21Z Indexed on 2010/04/23 23:13 UTC
Read the original article Hit count: 228

Filed under:
|

Hello, i'm pretty new to jquery. I'm trying to insert an element to the DOM, and get that element back in my script.

Ex:


    var elem = $("body").append("");
    $(elem).show();

but it seems that .append returns the whole jQuery object.. am i supposed to use an ID for the inserted element and always reference it by it?? i really hope that there is a smarter move here. I'm used to do it like that from Prototype..

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery